diff -u -r old/main/rfc1867.c php5-5.2.10.dfsg.1/main/rfc1867.c
--- old/main/rfc1867.c	2009-12-09 08:20:52.000000000 +0000
+++ php5-5.2.10.dfsg.1/main/rfc1867.c	2009-12-09 08:23:25.000000000 +0000
@@ -782,7 +782,7 @@
 {
 	char *boundary, *s=NULL, *boundary_end = NULL, *start_arr=NULL, *array_index=NULL;
 	char *temp_filename=NULL, *lbuf=NULL, *abuf=NULL;
-	int boundary_len=0, total_bytes=0, cancel_upload=0, is_arr_upload=0, array_len=0;
+	long total_bytes=0; int boundary_len=0, cancel_upload=0, is_arr_upload=0, array_len=0;
 	int max_file_size=0, skip_upload=0, anonindex=0, is_anonymous;
 	zval *http_post_files=NULL; HashTable *uploaded_files=NULL;
 #if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
diff -u -r old/main/SAPI.h php5-5.2.10.dfsg.1/main/SAPI.h
--- old/main/SAPI.h	2008-12-31 11:17:47.000000000 +0000
+++ php5-5.2.10.dfsg.1/main/SAPI.h	2009-12-09 08:23:25.000000000 +0000
@@ -80,7 +80,7 @@
 	char *post_data, *raw_post_data;
 	char *cookie_data;
 	long content_length;
-	uint post_data_length, raw_post_data_length;
+	uint IGNORE_post_data_length, IGNORE_raw_post_data_length;
 
 	char *path_translated;
 	char *request_uri;
@@ -111,6 +111,7 @@
 	int argc;
 	char **argv;
 	int proto_num;
+	long post_data_length, raw_post_data_length;
 } sapi_request_info;
 
 
@@ -118,7 +119,7 @@
 	void *server_context;
 	sapi_request_info request_info;
 	sapi_headers_struct sapi_headers;
-	int read_post_bytes;
+	long read_post_bytes;
 	unsigned char headers_sent;
 	struct stat global_stat;
 	char *default_mimetype;
diff -u -r old/sapi/apache/mod_php5.c php5-5.2.10.dfsg.1/sapi/apache/mod_php5.c
--- old/sapi/apache/mod_php5.c	2009-12-09 08:20:51.000000000 +0000
+++ php5-5.2.10.dfsg.1/sapi/apache/mod_php5.c	2009-12-09 08:23:25.000000000 +0000
@@ -511,7 +511,7 @@
 	SG(request_info).request_uri = r->uri;
 	SG(request_info).request_method = (char *)r->method;
 	SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE");
-	SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+	SG(request_info).content_length = (content_length ? atol(content_length) : 0);
 	SG(sapi_headers).http_response_code = r->status;
 	SG(request_info).proto_num = r->proto_num;
 
diff -u -r old/sapi/apache2filter/sapi_apache2.c php5-5.2.10.dfsg.1/sapi/apache2filter/sapi_apache2.c
--- old/sapi/apache2filter/sapi_apache2.c	2009-12-09 08:20:51.000000000 +0000
+++ php5-5.2.10.dfsg.1/sapi/apache2filter/sapi_apache2.c	2009-12-09 08:23:25.000000000 +0000
@@ -402,7 +402,7 @@
 	efree(content_type);
 
 	content_length = (char *) apr_table_get(f->r->headers_in, "Content-Length");
-	SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+	SG(request_info).content_length = (content_length ? atol(content_length) : 0);
 	
 	apr_table_unset(f->r->headers_out, "Content-Length");
 	apr_table_unset(f->r->headers_out, "Last-Modified");
diff -u -r old/sapi/apache2handler/sapi_apache2.c php5-5.2.10.dfsg.1/sapi/apache2handler/sapi_apache2.c
--- old/sapi/apache2handler/sapi_apache2.c	2009-12-09 08:20:51.000000000 +0000
+++ php5-5.2.10.dfsg.1/sapi/apache2handler/sapi_apache2.c	2009-12-09 08:23:25.000000000 +0000
@@ -464,7 +464,7 @@
 	r->no_local_copy = 1;
 
 	content_length = (char *) apr_table_get(r->headers_in, "Content-Length");
-	SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+	SG(request_info).content_length = (content_length ? atol(content_length) : 0);
 
 	apr_table_unset(r->headers_out, "Content-Length");
 	apr_table_unset(r->headers_out, "Last-Modified");
diff -u -r old/sapi/apache_hooks/mod_php5.c php5-5.2.10.dfsg.1/sapi/apache_hooks/mod_php5.c
--- old/sapi/apache_hooks/mod_php5.c	2008-12-31 11:17:48.000000000 +0000
+++ php5-5.2.10.dfsg.1/sapi/apache_hooks/mod_php5.c	2009-12-09 08:23:25.000000000 +0000
@@ -571,7 +571,7 @@
 	SG(request_info).request_method = (char *)r->method;
 	SG(request_info).proto_num = r->proto_num;
 	SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE");
-	SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+	SG(request_info).content_length = (content_length ? atol(content_length) : 0);
 	SG(sapi_headers).http_response_code = r->status;
 
 	if (r->headers_in) {
diff -u -r old/sapi/cgi/cgi_main.c php5-5.2.10.dfsg.1/sapi/cgi/cgi_main.c
--- old/sapi/cgi/cgi_main.c	2009-12-09 08:20:51.000000000 +0000
+++ php5-5.2.10.dfsg.1/sapi/cgi/cgi_main.c	2009-12-09 08:23:25.000000000 +0000
@@ -469,7 +469,7 @@
 {
 	int read_bytes=0, tmp_read_bytes;
 
-	count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes));
+	count_bytes = MIN(count_bytes,  SG(request_info).content_length - SG(read_post_bytes));
 	while (read_bytes < count_bytes) {
 #if PHP_FASTCGI
 		if (fcgi_is_fastcgi()) {
@@ -1188,7 +1188,7 @@
 		/* FIXME - Work out proto_num here */
 		SG(request_info).query_string = sapi_cgibin_getenv("QUERY_STRING", sizeof("QUERY_STRING")-1 TSRMLS_CC);
 		SG(request_info).content_type = (content_type ? content_type : "" );
-		SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+		SG(request_info).content_length = (content_length ? atol(content_length) : 0);
 		
 		/* The CGI RFC allows servers to pass on unvalidated Authorization data */
 		auth = sapi_cgibin_getenv("HTTP_AUTHORIZATION", sizeof("HTTP_AUTHORIZATION")-1 TSRMLS_CC);
diff -u -r old/Zend/zend_operators.c php5-5.2.10.dfsg.1/Zend/zend_operators.c
--- old/Zend/zend_operators.c	2009-02-17 15:15:36.000000000 +0000
+++ php5-5.2.10.dfsg.1/Zend/zend_operators.c	2009-12-09 08:23:25.000000000 +0000
@@ -42,9 +42,9 @@
 #define zend_tolower(c) tolower(c)
 #endif
 
-ZEND_API int zend_atoi(const char *str, int str_len)
+ZEND_API long zend_atoi(const char *str, int str_len)
 {
-	int retval;
+	long retval;
 
 	if (!str_len) {
 		str_len = strlen(str);
diff -u -r old/Zend/zend_operators.h php5-5.2.10.dfsg.1/Zend/zend_operators.h
--- old/Zend/zend_operators.h	2009-05-14 01:28:15.000000000 +0000
+++ php5-5.2.10.dfsg.1/Zend/zend_operators.h	2009-12-09 08:23:25.000000000 +0000
@@ -302,7 +302,7 @@
 ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC);
 ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC);
 
-ZEND_API int zend_atoi(const char *str, int str_len);
+ZEND_API long zend_atoi(const char *str, int str_len);
 
 ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC);
 END_EXTERN_C()
